Fix managed domain rebooting by only complaining about a VM name conflict if
authorEwan Mellor <ewan@xensource.com>
Thu, 30 Nov 2006 20:07:58 +0000 (20:07 +0000)
committerEwan Mellor <ewan@xensource.com>
Thu, 30 Nov 2006 20:07:58 +0000 (20:07 +0000)
the VM UUID conflicts as well.

Also, remove the previous_restart_time node when explicitly rebooting a guest --
the user ought to be able to drive reboots faster than the safety catch.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/XendDomainInfo.py

index 91aef248386de254794cd3a5e5300c22730fe059..d606dbb7bb34bba798da60201a76d38b88a28a40 100644 (file)
@@ -479,8 +479,9 @@ class XendDomainInfo:
         
         if reason not in DOMAIN_SHUTDOWN_REASONS.values():
             raise XendError('Invalid reason: %s' % reason)
+        self._removeVm('xend/previous_restart_time')
         self.storeDom("control/shutdown", reason)
-                
+
     def pause(self):
         """Pause domain
         
@@ -1692,8 +1693,9 @@ class XendDomainInfo:
             raise VmError('Invalid VM Name')
 
         dom =  XendDomain.instance().domain_lookup_nr(name)
-        if dom and dom != self and not dom.info['dying']:
-            raise VmError("VM name '%s' already exists" % name)
+        if dom and dom.info['uuid'] != self.info['uuid']:
+            raise VmError("VM name '%s' already exists as domain %s" %
+                          (name, str(dom.domid)))
         
 
     def update(self, info = None, refresh = True):